home *** CD-ROM | disk | FTP | other *** search
Text File | 1999-12-07 | 1.6 KB | 64 lines | [TEXT/R*ch] |
- This should show nothing: <:echo var1><P>
-
- Setting var1 to something...<:set var1 "something"><P>
-
- This should show something: <:echo var1><P>
-
- Create a new array <:set myArray <:new "ASOC">><P>
-
- Retrieve variable X from the array: <:echo myArray["X"]><P>
-
- Now set variable X to something valid: <:set myArray["X"] "valid thing"><P>
-
- Now try retrieving it again: <:echo myArray["X"]><P>
-
-
- Now for something more difficult. Set myArray[var1] to "cool thing"... <:set myArray[var1] "cool thing"><P>
-
- And now get it back as myArray["something"]: <:echo myArray["something"]><P>
-
- Let's try some require statements...<P>
-
- <:require var1 var2>
- Error! Var2 doesn't exist, so this shouldn't be displayed.
- <:else>
- This should display because var2 doesn't exist
- <:/require><P>
-
- <:require var1 var2>
- <:else>This should also be displayed because var2 does not exist.
- <:/require><P>
-
- <:require var1 myArray["something"]>
- This should display because var1 and myArray["something"] both exist.
- <:else>
- Error! This should not have displayed!
- <:/require><P>
-
- <:require var1 myArray["something"]>
- This should also display because var1 and myArray["something"] both exist.
- <:/require><P>
-
-
- Setting some more values in myArray...<P>
- <:set myArray[1] "one">
- <:set myArray[2] "two">
- <:set myArray[3] "three">
- <:set myArray["value"] "value">
-
- Now printing myArray: <:echo myArray><P>
-
- Now printing it in a more formatted way, using a loop:<P>
- <UL>
- <:foreach name value myArray>
- <:echo "<B><LI>" name ":</B>" value "<br>" >
- <:/foreach>
- </UL><P>
-
- Now lets see what is in the whole variable array:<P>
- <UL>
- <:foreach name value>
- <:echo "<B><LI>" name ":</B>" value "<br>" >
- <:/foreach>
- </UL><P>
-